#ifndef __EXTI_CONFIG_H__
#define __EXTI_CONFIG_H__

#include "gd32f4xx.h"
#include "systick.h"


#define USE_EXTI_0	0
#define USE_EXTI_1	0
#define USE_EXTI_2	0
#define USE_EXTI_3	0
#define USE_EXTI_4	0
#define USE_EXTI_5	0
#define USE_EXTI_6	0
#define USE_EXTI_7	0
#define USE_EXTI_8	0
#define USE_EXTI_9	1
#define USE_EXTI_10	0
#define USE_EXTI_11	0
#define USE_EXTI_12	0
#define USE_EXTI_13	1
#define USE_EXTI_14	0
#define USE_EXTI_15	0

/************************************************/
/********************* EXTI 0 *******************/
/************************************************/
#if USE_EXTI_0 
/////// PIN_0 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_0_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_0_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_0_IO_RCU			RCU_GPIOA
#define EXTI_0_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_0_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_0_NVIC				1, 1

#endif

/************************************************/
/********************* EXTI 1 *******************/
/************************************************/
#if USE_EXTI_1
/////// PIN_1 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_1_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_1_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_1_IO_RCU			RCU_GPIOA
#define EXTI_1_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_1_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_1_NVIC				1, 1

#endif

/************************************************/
/********************* EXTI 2 *******************/
/************************************************/
#if USE_EXTI_2
/////// PIN_2 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_2_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_2_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_2_IO_RCU			RCU_GPIOA
#define EXTI_2_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_2_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_2_NVIC				1, 1

#endif

/************************************************/
/********************* EXTI 3 *******************/
/************************************************/
#if USE_EXTI_3
/////// PIN_3 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_3_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_3_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_3_IO_RCU			RCU_GPIOA
#define EXTI_3_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_3_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_3_NVIC				1, 1

#endif

/************************************************/
/********************* EXTI 4 *******************/
/************************************************/
#if USE_EXTI_4
/////// PIN_4 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_4_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_4_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_4_IO_RCU			RCU_GPIOA
#define EXTI_4_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_4_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_4_NVIC				1, 1
#endif

/************************************************/
/********************* EXTI 5 *******************/
/************************************************/
#if USE_EXTI_5
/////// PIN_5 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_5_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_5_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_5_IO_RCU			RCU_GPIOA
#define EXTI_5_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_5_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_5_NVIC				1, 1
#endif

/************************************************/
/********************* EXTI 6 *******************/
/************************************************/
#if USE_EXTI_6
/////// PIN_6 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_6_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_6_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_6_IO_RCU			RCU_GPIOA
#define EXTI_6_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_6_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_6_NVIC				1, 1
#endif

/************************************************/
/********************* EXTI 7 *******************/
/************************************************/
#if USE_EXTI_7
/////// PIN_7 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_7_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_7_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_7_IO_RCU			RCU_GPIOA
#define EXTI_7_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_7_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_7_NVIC				1, 1
#endif

/************************************************/
/********************* EXTI 8 *******************/
/************************************************/
#if USE_EXTI_8

/////// PIN_0 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_8_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_8_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_8_IO_RCU			RCU_GPIOA
#define EXTI_8_IO_PORT		GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_8_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_8_NVIC				1, 1

#endif

/************************************************/
/********************* EXTI 9 *******************/
/************************************************/
#if USE_EXTI_9
/////// PIN_9 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_9_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_9_SRC_PORT		EXTI_SOURCE_GPIOF
// GPIOx
#define EXTI_9_IO_RCU			RCU_GPIOF
#define EXTI_9_IO_PORT		GPIOF
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_9_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_9_NVIC				1, 1

#endif

/************************************************/
/********************* EXTI 10 *******************/
/************************************************/
#if USE_EXTI_10
/////// PIN_10 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_10_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_10_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_10_IO_RCU			RCU_GPIOA
#define EXTI_10_IO_PORT			GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_10_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_10_NVIC				1, 1

#endif

/************************************************/
/********************* EXTI 11 *******************/
/************************************************/
#if USE_EXTI_11
/////// PIN_11 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_11_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_11_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_11_IO_RCU			RCU_GPIOA
#define EXTI_11_IO_PORT			GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_11_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_11_NVIC				1, 1
#endif

/************************************************/
/********************* EXTI 12 *******************/
/************************************************/
#if USE_EXTI_12
/////// PIN_12 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_12_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_12_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_12_IO_RCU			RCU_GPIOA
#define EXTI_12_IO_PORT			GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_12_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_12_NVIC				1, 1

#endif

/************************************************/
/********************* EXTI 13 *******************/
/************************************************/
#if USE_EXTI_13
/////// PIN_13 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_13_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_13_SRC_PORT		EXTI_SOURCE_GPIOC
// GPIOx
#define EXTI_13_IO_RCU			RCU_GPIOC
#define EXTI_13_IO_PORT			GPIOC
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_13_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_13_NVIC				1, 1
#endif


/************************************************/
/********************* EXTI 14 *******************/
/************************************************/
#if USE_EXTI_14
/////// PIN_14 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_14_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_14_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_14_IO_RCU			RCU_GPIOA
#define EXTI_14_IO_PORT			GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_14_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_14_NVIC				1, 1
#endif


/************************************************/
/********************* EXTI 15 *******************/
/************************************************/
#if USE_EXTI_15
/////// PIN_15 //////
// EXTI_TRIG_RISING, EXTI_TRIG_FALLING, EXTI_TRIG_BOTH
#define EXTI_15_TRIG				EXTI_TRIG_BOTH

// EXTI_SOURCE_GPIOx
#define EXTI_15_SRC_PORT		EXTI_SOURCE_GPIOA
// GPIOx
#define EXTI_15_IO_RCU			RCU_GPIOA
#define EXTI_15_IO_PORT			GPIOA
// GPIO_PUPD_NONE,GPIO_PUPD_PULLUP,GPIO_PUPD_PULLDOWN
#define EXTI_15_IO_PULL		GPIO_PUPD_PULLUP

#define EXTI_15_NVIC				1, 1
#endif



#endif
